/* redux切片   就是将单个功能的reducer逻辑和action整合  vuex-modules */
import {createSlice} from '@reduxjs/toolkit'
/* 可以使用createSlice定义一个切片 也就是vuex中的module */
const counterSlice = createSlice({
    name:"counter",
    initialState:{
        count:0
    },
    reducers:{
        increase:state=>{
           state.count+=1
        }
    }
})
export const {increase} =counterSlice.actions;
export const selectCount = state=>state.counter.count
export default counterSlice.reducer;